<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="${pageContext.request.contextPath }/">
    
    <title>修改</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" href="layui/css/layui.css">
	<style type="text/css">
		.title{
			height: 30px;
			line-height:30px;
			text-align:center;
			font-weight:bold;
			margin-bottom:5px;
			background-color: #39c5bb
		}
	</style>
	<script type="text/javascript" src="ht/layui/layui.all.js" ></script>
	<link rel="stylesheet" href="ht/layui/css/layui.css">
	<script type="text/javascript" src="ht/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="ht/ueditor/ueditor.all.js"></script>
	<script type="text/javascript" src="ht/js/mouse.js"></script>
	<script type="text/javascript">
		layui.use(['layer','form','laydate'], function(){
			 layer = layui.layer //弹层
			,$ = layui.$ //$是jquery对象
			,form = layui.form //表单
			 ,layedit = layui.layedit
			
			
			form.render();
			//监听提交
			form.on('submit(btnAdd)', function(data){
				var v = $('form').serialize(); //获取表单数据
				$.post('carsaction!upda',v,function(data){
					   //data：-1 异常   0-编号已存在   1-成功
					  if(data == -1){
					    	layer.msg('异常了', {time: 2000 },function(){
					    		window.parent.layui.table.reload('sermodel'); //让列表页面重写加载数据
					    		closeThis();
					    	});
					    		
					   }else if(data == 0){
					    	layer.msg('修改失败', {time: 2000 });
					    }else{
					    	layer.msg('修改成功', {time: 2000 },function(){
					    		window.parent.layui.table.reload('sermodel');
					    		closeThis();
					    	});
					    }
				});
				return false;
			});
			
			
			//取消按钮
			$('#btnCancel').click(function(){
				closeThis();
			})
		});
		
		//关闭当前窗口
		function closeThis(){
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
			window.document.body.innerHTML = "";
		}
	</script>
  </head>
  <body style="background-color: #EAEAEA">
    <form  class="layui-form">
    <input type="hidden" name="car.sermodelId" value="${car.sermodelId }">
      <div class="layui-form-item">
		      <label class="layui-form-label">车型名称</label>
		      <div class="layui-input-block">
		        <input name="car.sermodelName" value="${car.sermodelName }" lay-verify="title" autocomplete="off" class="layui-input" >
		      </div>
		    </div>
		    <div class="layui-form-item">
		      <label class="layui-form-label">车型图片</label>
		      <div class="layui-input-block">
		        <input name="car.sermodelImg" value="${car.sermodelImg }" lay-verify="title" autocomplete="off" class="layui-input" >
		      </div>
		    </div>
		<div class="layui-form-item">
		 	<label class="layui-form-label">车型详情</label>
		 	<div class="layui-input-block">
		 		<textarea id="jyjl" name="car.sermodelContent" lay-verify="required">${car.sermodelContent }</textarea>
			 	<script type="text/javascript">
			        var jyjl = UE.getEditor('jyjl',{
			        		elementPathEnabled:false,
			        		initialFrameWidth:'70%',
			        		initialFrameHeight:150,
			        		toolbars: [
							    [
							        'undo', //撤销
							        'redo', //重做
							        'bold', //加粗
							        'fontfamily', //字体
							        'fontsize', //字号
							        'paragraph', //段落格式
							        'forecolor', //字体颜色
	        						'backcolor', //背景色
							        'removeformat', //清除格式
							     ]
							 ]
			        });
			    </script>
		 	</div>
		 </div>
		 <div style="position: fixed;right:10px;bottom:10px">
		 	<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btnAdd">修  改</button>
			<button class="layui-btn layui-btn-danger" style="margin-right: 10px" id="btnCancel">取  消</button>
		 </div>
    </form>
  </body>
</html>
